package com.tbit.uqbike.client.service.impl;

import com.tbit.uqbike.client.dao.log.VerticalParkLogDao;
import com.tbit.uqbike.client.pojo.newEntity.VerticalParkLog;
import com.tbit.uqbike.client.service.VerticalParkLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @Author: chen
 * @Description:
 * @Date: 创建于 15:18 2023/7/11
 */
@Service
public class VerticalParkLogServiceImpl implements VerticalParkLogService {
    @Autowired
    private VerticalParkLogDao verticalParkLogDao;

    @Override
    public VerticalParkLog getByOrderNO(String orderNO) {

        return verticalParkLogDao.getByOrderNO(orderNO);
    }

    @Override
    public void add(VerticalParkLog verticalParkLog) {
        verticalParkLog.setAddTime(new Date());
        VerticalParkLog verticalParkLogDB = getByOrderNO(verticalParkLog.getOrderNO());
        if (verticalParkLogDB != null) {
            verticalParkLogDao.edit(verticalParkLog);
        } else {
            verticalParkLogDao.add(verticalParkLog);
        }
    }

    @Override
    public void edit(VerticalParkLog verticalParkLog) {

        verticalParkLogDao.edit(verticalParkLog);
    }

    @Override
    public void editEnable(String machineNO) {
        verticalParkLogDao.editEnable(machineNO);
    }
}
